package a.h;

import a.i.ib;
import a.i.jb;

import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyVetoException;
import java.util.Map;

abstract class h
  extends d
{
  public static final String n = "converter";
  public static final String o = "document";
  protected JTextComponent p;
  protected boolean r;
  String s;
  jb t;
  private final DocumentListener u;
  static Class v;
  
  protected h(ec paramec, Map paramMap, JTextComponent paramJTextComponent)
  {
    super(paramec);
    Object localObject;
    if (i == 0)
    {
      this.t = null;
      if (paramMap != null)
      {
        localObject = paramMap.get(pc.z);
        if ((localObject instanceof jb)) {
          this.t = ((jb)localObject);
        }
      }
    }
    if ((i != 0) || (this.t == null))
    {
      localObject = paramec.c(pc.z);
      if (i == 0)
      {
        if ((localObject instanceof jb))
        {
          if (i != 0) {
            break label111;
          }
          this.t = ((jb)localObject);
        }
      }
      else {
        if (!bool2) {
          break label117;
        }
      }
      label111:
      this.t = ib.c();
    }
    label117:
    boolean bool1;
    if (paramMap != null)
    {
      bool1 = Boolean.TRUE.equals(paramMap.get("ItemEditor.selectTextOnFocusGained"));
      if (i != 0) {
        break label188;
      }
      if (!bool2) {}
    }
    else
    {
      bool1 = Boolean.TRUE.equals(paramec.c("ItemEditor.selectTextOnFocusGained"));
    }
    this.p = paramJTextComponent;
    if (i == 0)
    {
      this.p.addKeyListener(new KeyAdapter()
      {
        public void keyPressed(KeyEvent paramAnonymousKeyEvent)
        {
          if ((ec.t != 0) || ((10 == paramAnonymousKeyEvent.getKeyCode()) && (2 == paramAnonymousKeyEvent.getModifiers()))) {
            h.this.h();
          }
        }
      });
      if (bool1)
      {
        label188:
        d_ locald_ = new d_();
        this.p.addFocusListener(locald_);
        this.p.addMouseListener(locald_);
        if (i != 0) {
          return;
        }
        if (!bool2) {
          break label244;
        }
      }
    }
    this.p.addFocusListener(new FocusAdapter()
    {
      public void focusLost(FocusEvent paramAnonymousFocusEvent)
      {
        h.this.a(paramAnonymousFocusEvent);
      }
    });
    label244:
    a(paramec, paramMap);
    a(b(paramec.o()), true);
    this.r = false;
    d(paramec.m());
    c(paramec.f());
    this.u = new a_(this);
    this.p.getDocument().addDocumentListener(this.u);
  }
  
  void a(ec paramec, Map paramMap) {}
  
  public void d(boolean paramBoolean)
  {
    int i = ec.t;
    if ((i != 0) || (p() != paramBoolean))
    {
      boolean bool = this.r;
      if (i == 0)
      {
        this.r = paramBoolean;
        if (paramBoolean)
        {
          this.p.setBackground(ad.d());
          if (i != 0) {
            break label79;
          }
          this.p.setText("");
          if (!ec.s) {
            break label78;
          }
        }
      }
      this.p.setBackground(e(o()));
      label78:
      label79:
      b(bool, paramBoolean);
    }
  }
  
  abstract Color e(boolean paramBoolean);
  
  public Object n()
  {
    return a(this.s);
  }
  
  public void a(Object paramObject)
  {
    a(b(paramObject), true);
  }
  
  public Document b()
  {
    return this.p.getDocument();
  }
  
  public void a(Document paramDocument)
  {
    Document localDocument = this.p.getDocument();
    if ((ec.t != 0) || (nb.a(localDocument, paramDocument)))
    {
      localDocument.removeDocumentListener(this.u);
      String str = this.p.getText();
      this.p.setDocument(paramDocument);
      a(o, localDocument, paramDocument);
      this.p.setText(str);
      paramDocument.addDocumentListener(this.u);
    }
  }
  
  public boolean o()
  {
    return this.p.isEnabled();
  }
  
  public void c(boolean paramBoolean)
  {
    boolean bool = this.p.isEnabled();
    if (ec.t == 0)
    {
      if (bool != paramBoolean) {
        this.p.setEnabled(paramBoolean);
      }
    }
    else {
      a(bool, paramBoolean);
    }
  }
  
  public boolean p()
  {
    return this.r;
  }
  
  public JComponent f()
  {
    return this.p;
  }
  
  public jb g()
  {
    return this.t;
  }
  
  public void a(jb paramjb)
  {
    jb localjb = this.t;
    if (ec.t == 0)
    {
      if (nb.a(localjb, paramjb)) {
        this.t = paramjb;
      }
    }
    else {
      a(n, localjb, paramjb);
    }
  }
  
  void a(String paramString, boolean paramBoolean)
  {
    int i = ec.t;
    String str = this.s;
    if (nb.a(str, paramString))
    {
      Object localObject1 = null;
      Object localObject2 = null;
      try
      {
        localObject1 = a(str);
        localObject2 = a(paramString);
      }
      catch (Exception localException)
      {
        this.p.setText(str);
        return;
      }
      if ((i != 0) || (!nb.a(localObject1, localObject2)))
      {
        if (paramBoolean) {
          this.p.setText(str);
        }
        return;
      }
      try
      {
        b(e, localObject1, localObject2);
      }
      catch (PropertyVetoException localPropertyVetoException)
      {
        this.p.setText(str);
        return;
      }
      if (i == 0)
      {
        this.s = b(localObject2);
        if (paramBoolean) {
          this.p.setText(this.s);
        }
      }
      a(localObject1, localObject2);
    }
  }
  
  private String b(Object paramObject)
  {
    int i = ec.t;
    if ((i != 0) || ((paramObject instanceof String))) {
      return (String)paramObject;
    }
    if (i == 0) {}
    ib localib = this.t != null ? this.t : ib.c();
    if (i == 0) {}
    return localib.a(paramObject, v == null ? (h.v = b("java.lang.Object")) : (i != 0) || (paramObject != null) ? paramObject.getClass() : v);
  }
  
  private Object a(String paramString)
  {
    if (ec.t == 0) {}
    ib localib = this.t != null ? this.t : ib.c();
    return localib.a(paramString, this.i.c());
  }
  
  protected void h()
  {
    a(this.p.getText(), false);
  }
  
  private void a(FocusEvent paramFocusEvent)
  {
    if (ec.t == 0) {
      if ((!p()) && (!paramFocusEvent.isTemporary())) {
        h();
      }
    }
    this.p.setCaretPosition(0);
  }
  
  static int b(ec paramec, Map paramMap)
  {
    int i = ec.t;
    Object localObject1 = paramec.c(tc.E);
    if (i == 0) {
      if (paramMap != null)
      {
        if (i != 0) {
          break label65;
        }
        if (c(paramMap.get(cd.i)))
        {
          Object localObject2 = paramec.c(tc.G);
          if (i != 0) {
            break label62;
          }
          if (localObject2 != null) {
            localObject1 = localObject2;
          }
        }
      }
    }
    label62:
    label65:
    if (i == 0) {
      if ((localObject1 instanceof Integer)) {
        return ((Integer)localObject1).intValue();
      }
    }
    return 5;
  }
  
  static int c(ec paramec, Map paramMap)
  {
    int i = ec.t;
    Object localObject1 = paramec.c(tc.F);
    if (i == 0) {
      if (paramMap != null)
      {
        if (i != 0) {
          break label65;
        }
        if (c(paramMap.get(cd.i)))
        {
          Object localObject2 = paramec.c(tc.H);
          if (i != 0) {
            break label62;
          }
          if (localObject2 != null) {
            localObject1 = localObject2;
          }
        }
      }
    }
    label62:
    label65:
    if (i == 0) {
      if ((localObject1 instanceof Integer)) {
        return ((Integer)localObject1).intValue();
      }
    }
    return 5;
  }
  
  private static boolean c(Object paramObject)
  {
    int i = ec.t;
    try
    {
      if (i == 0) {
        if (paramObject == null) {
          return false;
        }
      }
      if ((i != 0) || ((paramObject instanceof Boolean))) {
        return ((Boolean)paramObject).booleanValue();
      }
    }
    catch (Exception localException)
    {
      System.err.println("WARNING: YUtil.getBool cannot convert to boolean");
    }
    return false;
  }
  
  static Class b(String paramString)
  {
    try
    {
      return Class.forName(paramString);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  private static final class a_
    implements DocumentListener
  {
    private final h a;
    
    public a_(h paramh)
    {
      this.a = paramh;
    }
    
    public void changedUpdate(DocumentEvent paramDocumentEvent)
    {
      a();
    }
    
    public void insertUpdate(DocumentEvent paramDocumentEvent)
    {
      a();
    }
    
    public void removeUpdate(DocumentEvent paramDocumentEvent)
    {
      a();
    }
    
    private void a()
    {
      if ((ec.t != 0) || (c() > 0)) {
        this.a.d(false);
      }
    }
    
    private int c()
    {
      return (ec.t != 0) || (this.a.p != null) ? this.a.p.getText().length() : -1;
    }
  }
  
  private class d_
    extends MouseAdapter
    implements FocusListener
  {
    private boolean a = false;
    
    public d_() {}
    
    public void focusGained(FocusEvent paramFocusEvent)
    {
      if (ec.t == 0) {
        if (!this.a) {
          h.this.p.selectAll();
        }
      }
      this.a = false;
    }
    
    public void focusLost(FocusEvent paramFocusEvent)
    {
      h.this.a(paramFocusEvent);
    }
    
    public void mousePressed(MouseEvent paramMouseEvent)
    {
      this.a = true;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.h.h

 * JD-Core Version:    0.7.0.1

 */